#define  _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <functional>
#include <type_traits>


template<class Fn, class ...Args, std::enable_if_t<std::is_member_function_pointer_v<std::remove_cv_t<Fn>>, int> = 0>
auto BindFunction(Fn&& f, Args && ...args)
{
	auto parameters = std::make_tuple(std::forward<Args>(args)...);
	auto obj = std::get<0>(parameters);
	return [f = std::forward<Fn>(f), parameters = std::move(parameters), obj]() {
		return std::apply([f, obj](auto&& first, auto&& ...args){
			return (obj->*f)(std::forward<decltype(args)>(args)...);
		}, parameters);
		
	};
}

template<class Fn, class ...Args>
auto BindFunction(Fn&& f, Args && ...args)->std::function<decltype(std::declval<Fn>()(std::declval<Args...>()))()>
{
	return std::bind(std::forward<Fn>(f), std::forward<Args>(args)...);
}


class A
{
public:
	int Get(int idx, bool check)
	{
		return 1;
	}
};


int main()
{
	A a;
	auto it = BindFunction(&A::Get, &a, 1, true);
	std::cout << it() << std::endl;
	return 0;
}